package ex161;

import java.util.ArrayList;
import java.util.Scanner;
 
public class Main {
 
    public static void main(String args[]) {
 
        Scanner in = new Scanner(System.in);
         
        int m, n, mFat, nFat, soma = 0;
        String input, inputParts[];
        ArrayList<Integer> result = new ArrayList<Integer>();
        
        while(in.hasNextLine()) {
        	
        	input = in.nextLine();
             
            if (!input.trim().equals("")) {
                inputParts = input.split(" ", 2);
                m = Integer.parseInt(inputParts[0]);
                n = Integer.parseInt(inputParts[1]);
                 
                mFat = m==0?1:m;
                nFat = n==0?1:n;
                 
                for (int i = m-1; i >= 2 ; i--) {
                    mFat = mFat * i;
                }
                for (int i = n-1; i >= 2 ; i--) {
                    nFat = nFat * i;
                }
                soma = mFat + nFat;
                result.add(soma);
            } else {
                break;
            }
             
        }
         
        for (int i = 0; i < result.size(); i++) {
            System.out.println(result.get(i));
        }
        
        in.close();
         
    }
     
}